﻿// Copyright (c) 2011 Blue Onion Software, All rights reserved
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Web.UI.Design;
using BlueOnionSoftware.Bloget.Properties;

namespace BlueOnionSoftware.Bloget
{
    public class BlogetDashboard : Bloget
    {
        protected override void CreateChildControls()
        {
        }
    }

    /// <summary>
    /// DashboardContainerControl defines what can be referenced in the Dashboard
    /// template
    /// </summary>
    public class DashboardContainerControl : BlogContainerControl
    {
        public DashboardContainerControl(Bloget bloget, Blog blog)
            : base(bloget, blog)
        {
        }
    }

    internal class BlogetDashboardDesigner : ControlDesigner
    {
        [SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods")]
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);
            SetViewFlags(ViewFlags.TemplateEditing, true);
        }

        public override string GetDesignTimeHtml()
        {
            return "<span>" + Resources.ArchiveViewDesignTimeHtml + "</span>";
        }

        public override bool AllowResize
        {
            get { return true; }
        }

        [SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods")]
        public override TemplateGroupCollection TemplateGroups
        {
            get
            {
                var collection = new TemplateGroupCollection();
                var control = (Bloget) Component;
                var group = new TemplateGroup("Bloget");
                var template = new TemplateDefinition(this, "DashboardTemplate", control, "DashboardTemplate", true);
                group.AddTemplateDefinition(template);
                collection.Add(group);
                return collection;
            }
        }
    }
}